import unittest,logging
from script.test_emp_add import TestAddEmp
from script.test_login import TestLogin
from script.test_emp_get import TestGetEmp
from script.test_emp_put import TestPutEmp
from script.test_emp_delete import TestDeletEmp
from htmltestreport import HTMLTestReport
from IHRMSYSAUTO.common.logging_use import loging_init
from config import path
#执行日志公用方法，传递参数，绝对路径拼接，日志文件名为test.log，存储到log文件夹中
loging_init(filename=path+'/log/test.log')

sute = unittest.TestSuite()

sute.addTest(unittest.makeSuite(TestLogin))
logging.info('添加测试套件TestLogin成功')       #设置日志埋点，提示信息为 info
sute.addTest(unittest.makeSuite(TestAddEmp))
logging.info('添加测试套件TestAddEmp成功')
sute.addTest(unittest.makeSuite(TestGetEmp))
logging.info('添加测试套件TestGetEmp成功')
sute.addTest(unittest.makeSuite(TestPutEmp))
logging.info('添加测试套件TestPutEmp成功')
sute.addTest(unittest.makeSuite(TestDeletEmp))
logging.info('添加测试套件TestDeletEmp成功')
runner = HTMLTestReport('./Report/test.html',description="登录模块和员工模块测试用例",title="TestReport")

runner.run(sute)
logging.info("测试用例执行成功")